package com.zzh.takeoutapp.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.zzh.takeoutapp.R;
import com.zzh.takeoutapp.adapter.order.more.RvAdapter;
import com.zzh.takeoutapp.adapter.order.more.RvHolder;
import com.zzh.takeoutapp.adapter.order.more.RvListener;
import com.zzh.takeoutapp.utils.ImageManager;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2018/7/28.
 */

public class MerchantAdapter extends RvAdapter<String> {
    private Context mContext;
    private List<String> list;

    public MerchantAdapter(Context context, List<String> list, RvListener listener) {
        super(context, list, listener);
        this.mContext = context;
        this.list = list;
    }

    @Override
    protected int getLayoutId(int viewType) {
        return R.layout.item_merchant_shop;
    }

    @Override
    protected RvHolder getHolder(View view, int viewType) {
        return new MerchantHolder(view, viewType, listener);
    }


    public class MerchantHolder extends RvHolder<String> {
        @Bind(R.id.ivAvatar)
        ImageView imageView;

        public MerchantHolder(View itemView, int type, RvListener listener) {
            super(itemView, type, listener);
            ButterKnife.bind(this, itemView);
        }

        @Override
        public void bindHolder(String s, int position) {
            ImageManager.loadUrlImage(mContext, list.get(position), imageView);
        }
    }
}
